<?php
	require_once("header.php");
	
	$pageurl = "admin.php";
	$adminsection = "home";
	if (isset($_GET['s']))
		$adminsection = $_GET['s'];
	
	$adminsection = "admin_$adminsection.php";
	
    if (!file_exists($adminsection))
	{
		$adminpage = "Cannot find the admin section specified.";
	}
	else if (check_permission('admin', 0))
	{
		ob_start();
		require $adminsection;
		$adminpage = ob_get_clean();
	}
	else
	{
		$adminpage = '<h2>Admin &raquo; Home</h2>You do not belong to a User Group that is allowed to administer this website.';
	}
	
	render_template("header.inc", array('$title' => "Administration"));
	render_template("body.inc", array(
		'$title' => $config_site_name,
		'$menu' => generate_menu(),
		'$login' => generate_login(),
		'$content' => $adminpage
	));
	render_template("footer.inc", array());
?>